<?php
/**
 * Created by PhpStorm.
 * User: august
 * Date: 2021/3/31
 * Time: 17:30
 */
include '../vendor/autoload.php';

use Aug\Tools\RateLimit;

function callApi()
{
    try {
        $redis = new \Redis();
        $redis->connect('192.168.1.247', 6379);
        $redis->auth('august');
        $res = RateLimit::getInstance($redis)->minLimit(1, 10, 10000);
        if ($res) {
            echo $res . "\n";
        } else {
            echo "success\n";
        }
    } catch(\Exception $e) {
        echo $e->getMessage();
    }
}

foreach (range(1, 14) as $i) {
    callApi();
}